import Vue from 'vue'
import VueRouter from 'vue-router'
// import Home from '../views/home.vue'
// @ 默认表示 src目录
import Index from '@/views/index.vue'
import Home from '@/views/tabbar/home.vue'
Vue.use(VueRouter)

// 路由规则数组
const routes = [
  {
    path: '/',
    //路由重定向到/index
    redirect: '/index'
  },
  {
    path: '/index', redirect: '/home', component: Index, children: [
      { path: '/home', name: 'home', component: Home },
      { path: '/cates', name: 'cates', component: () => import('@/views/tabbar/cates.vue') },
      { path: '/search', name: 'search', component: () => import('@/views/tabbar/search.vue') }
    ]
  },
  { path: '/pages/goods_list', name: 'goodslist', component: () => import('@/views/goods/goods_list.vue') },
  { path: '/pages/goods_detail/:id', name: 'goodsdetail', component: () => import('@/views/goods/goods_detail.vue') },
  { path: '/pages/address_list', name: 'addresslist', component: () => import('@/views/address/address_list.vue') },
  { path: '/pages/address_edit', name: 'addressedit', component: () => import('@/views/address/address_edit.vue') }
]

const router = new VueRouter({
  routes
})

export default router
